<?php

class Admin_Form_LopForm extends Zend_Form
{
  	/**
     * 
     * Tao form voi tuy chon them xoa sua
     * @param unknown_type $action : ten action trong controller
     * @param $nameSumit: ten bien cua nut submit
     * @param unknown_type $labelSumit: ten cho nut submit tuong ung voi cac action
     * @param $id: ten khoa(ma lop) can edit - default = null
     */
	
    public function init(){
    	
    	$this->setMethod('post');
//		$this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl().'/admin/lop/');
    	$this->setAttrib('class', 'validate-form');
		    	
    	$this->addElement('text','txtId',array(
    						'required'	=>	true,
    						'label'		=>	'Mã lớp',
    						'class'		=>	'required'
    					));
       	$this->addElement('text','txtName',array(
       						'required'	=> true,
       						'label'		=>	'Tên lớp',
       						'class'		=>	'required'
       					));
       	$this->addElement('text','txtKhoa',array(
       						'label'		=>	'Khóa học',
       						'required'	=>true,
       						'class'		=>	'required number'
       					));
       
		$this->addElement('reset','cmdReset',array(
							'class'		=>	'input-hover cSubmit',
							'label'		=>	'Reset'
						));
    }
	
    /**
     * 
     * Them nut luu khi chon chuc nang sua vao trong form
     */
    function addSubmitSave(){
    	$this->addElement('submit','cmdEdit',array(
    						'class'		=>	'input-hover cSubmit',
    						'decorators'	=>	array('ViewHelper',array(
    																'HtmlTag',array('tag' => 'dd'
    																		)	
    												  			)
    												),
    						'label'		=>	'Lưu' 
    				));
    }
  
    /**
     * 
     * Them Action vao trong form
     * @param unknown_type $action : action se thuc thi trong form
     */
    function addAction($action){
    	$this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl().'/admin/lop/'.$action);
    }
    
    /**
     * 
     * Them nut Them vao trong form
     */
    function addSubmitAdd(){
    	$this->addElement('submit','cmdAdd',array(
    						'decorators'	=>	array('ViewHelper',array(
    																'HtmlTag',array('tag' => 'dd'
    																		)	
    												  			)
    												),
    						'class'			=>	'input-hover cSubmit',
    						'label'			=>	'Thêm' 
    				));
    }
    
    function addHiddenId($name,$value){
    	$this->addElement('hidden',$name,array(
    							'value'		=>	$value
    						));
    }
    

}

